#include <iostream>
#include <string>

int a[100];
int n, len = 0;
std::string s;

std::string get(int x)
{
	if (!x) return "[+![]]";
	else if (x == 1) return "[+!![]]";
	else if (x == 2) return "[!![]+!![]]";
	else if (x == 3) return "[!![]+!![]+!![]]";
	else if (x == 4) return "[!![]+!![]+!![]+!![]]";
	else if (x == 5) return "[!![]+!![]+!![]+!![]+!![]]";
	else if (x == 6) return "[!![]+!![]+!![]+!![]+!![]+!![]]";
	else if (x == 7) return "[!![]+!![]+!![]+!![]+!![]+!![]+!![]]";
	else if (x == 8) return "[!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![]]";
	return "[!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![]+!![]]";
}

int main()
{
	std::ios::sync_with_stdio(false);
	int T; std::cin >> T;
	while (T--) {
		std::cin >> n;
		int tn = n;
		len = 0;
		while (tn) { a[len++] = tn % 10; tn /= 10; }
		s = get(a[len - 1]);
		for (int i = len - 2; i >= 0; i--)
			s += "+" + get(a[i]);
		s = "+[" + s + "]";
		std::cout << s << '\n';
	}
}

